package com.joker.coupon.remote.factory;

import com.joker.common.core.domain.Result;
import com.joker.coupon.domain.PmsCoupon;
import com.joker.coupon.remote.IPmsCouponRemoteService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author lemon
 * @date 2024/12/29 15:07
 **/
@Component
@Slf4j
public class PmsCouponRemoteFallbackFactory implements FallbackFactory<IPmsCouponRemoteService> {
    @Override
    public IPmsCouponRemoteService create(Throwable cause) {
        return new IPmsCouponRemoteService() {
            @Override
            public Result<List<PmsCoupon>> selectCouponByCart(Long skuId) {
                log.error("调用失败", cause);
                return Result.error("调用失败");
            }
        };
    }
}
